@extends('generalAdmin.general-admin-layouts')
@section('style')
    <meta name="_token" content="{{ csrf_token() }}"/>
    <style>
        .trademark-th{
            text-align: center;
            color: #676767;
        }
        .trademark-td{
            text-align: center;
            color: #676767;
        }
    </style>
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap-datetimepicker.min.css')}}">
    <link rel="stylesheet" href="{{url('css/search.css')}}">
@stop
@section('content')
    <div class="content-wrapper" style="background-color: white">
        <section id="list" class="content">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="box box-info"
                         style="padding-top: 0px;margin-top: 0px;border-top: 0px;border-bottom: solid 1px #009aff;">
                        <div class="box-body" style="">
                            <div class="row">
                                <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12" style="margin-top: 1%">
                                    <a href="{{url('generalAdmin/index')}}" title="返回首页" style="float: left"><i class="fa fa-home fa-2x"
                                                                                                                style="width: 100%;color: #009aff">
                                        </i></a>
                                    <a href="{{url('generalAdmin/copyright')}}"><span style="font-size: 20px;float: left;color: #009aff">&nbsp;版权审阅</span></a>
                                    <div class="clear"></div>
                                </div>
                                {{--<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12  col-lg-offset-8 col-md-offset-8">--}}
                                    {{--<form action="{{url('Admin/generalAdmin/copyrightSearch')}}" method="post" enctype="multipart/form-data" class="search">--}}
                                        {{--{{csrf_field()}}--}}
                                        {{--<button class="fa fa-search fa-lg"></button>--}}
                                        {{--<input type="search" class="search" value="{{$keywords}}" id="search-input" name="search">--}}
                                    {{--</form>--}}
                                {{--</div>--}}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            @include('public/alert')
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th class="trademark-th">序号</th>
                                <th class="trademark-th">申请人</th>
                                <th class="trademark-th">版权类别</th>
                                <th class="trademark-th">类型</th>
                                <th class="trademark-th">登记号</th>
                                <th class="trademark-th">名称</th>
                                <th class="trademark-th">申请日期</th>
                                <th class="trademark-th">授权日期</th>
                                <th class="trademark-th">报件员</th>
                                <th class="trademark-th">进度</th>
                                <th class="trademark-th">有效期监控</th>
                                <th class="trademark-th">报件资料</th>
                                <th class="trademark-th">官方文件</th>
                                <th class="trademark-th">详情</th>
                            </tr>
                            </thead>
                            <tbody class="list">
                            @if($product->isEmpty())
                                <tr>
                                    <td colspan="14" style="text-align: center;color: #676767">暂无数据</td>
                                </tr>
                            @else
                                @foreach($product as $k => $v)
                                    @php($item=$v['Product'])
                                    <tr>
                                        <td class="trademark-td">{{$k+1}}</td>
                                        <td class="trademark-td applicant">{{$item['applicant']}}</td>
                                        <td class="trademark-td is_renew">
                                            @if($v['is_renew']==0)
                                                首次任务
                                            @else
                                                续费任务
                                            @endif
                                            @if($v['urge']==1)
                                                <small class="label pull-right bg-red">催</small>
                                            @endif
                                        </td>
                                        <td class="trademark-td secondType">{{$v['SecondType']['name']}}</td>
                                        <td class="trademark-td number">{{$item['number']}}</td>
                                        <td class="trademark-td name">{{$item['name']}}</td>
                                        <td class="trademark-td registration_time">{{$item['registration_time']}}</td>
                                        <td class="trademark-td authority_time">{{$item['authority_time']}}</td>
                                        <td class="trademark-td agent">{{$v['agent']}}</td>

                                        <td class="trademark-td progress_list_id">{{$progress[$v['progress_list_id']]['name']}}</td>
                                        <td class="trademark-td"></td>
                                        <td class="trademark-td file">
                                            @if(empty($item['file']))
                                                未上传
                                            @else
                                                <a href="{{asset('Uploads/resources/'.$item['file'])}}">
                                                    下载资料
                                                </a>
                                            @endif
                                        </td>
                                        <td class="trademark-td is_download_notice">
                                            @if($item['is_download_notice']!=0)
                                                <a href="javascript:void(0);" product="{{$v['id']}}" onclick="ajxZip($(this))">下载资料</a>
                                            @else
                                                未上传
                                            @endif
                                        </td>
                                        <td class="trademark-td">
                                            <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}">查看详情</a>
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    </div>
@stop
@section('javascript')
    <script src="{{asset('js/ip.js')}}"></script>
    <script src="{{asset('js/list.min.js')}}"></script>
    <script>
        var options = {
            valueNames: ['applicant', 'is_renew','secondType','number','name','registration_time','authority_time','agent','progress_list_id','file','is_download_notice']
        };
        var List = new List('list', options);
        List.search($('#search-input').val());
        function ajxZip(e) {
            $.ajax({
                url: '{{url("Admin/generalAdmin/ajxZip")}}',
                type: 'post',
                dataType: "json",
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                },
                data:{
                    'id':e.attr('product')
                },
                success: function (data) {
                    if(data=="0"){
                        alert("暂无附件资料");
                    }else{
                        window.location.href=data;
                    }

                }

            });
        }
    </script>
@stop
